﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class msgDo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            msg_do();
        }
    }
    void msg_do()
    {
        String safecode = Request["safecode"];
        if (safecode == Session["safecode"].ToString())
        {
            String name = Request["title"];
            String tel = Request["telephone"];
            String content = Request["content"];
            string datestr = DateTime.Now.ToString();
            string sql = "insert into msg(name,tel,content,adddate) values('"
                + name + "','" + tel + "','" + content + "','" + datestr + "')";
            //Response.Write(sql);
            DB.doNonQuery(sql);
            Response.Write("<script>alert('提交成功');location.href='msg.aspx?channel=" + Request["channel"] + "';</script>");
        }
        else
        {
            Response.Write("<script>alert('验证码错误');history.back(-1);</script>");
        }
    }
}
